<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!--    1.promise 中的语句除了resolve,reject能直接执行
            2.遇到await先跳出函数执行他的同步代码，最后执行自己
            3.定时器最后执行
    -->
    <script>
        async function show(){
            console.log("start");
            var res = await go();
            console.log(res);
        }
        async function go (){
            return 1;
        }
        show();
        setTimeout(() => {
            console.log(4); 
        }, );
        var p = new Promise((resolve,reject)=>{
            console.log(2);
            resolve(3);
            console.log(5);
        })
        p.then((res)=>{
            console.log(res);
        })
        console.log("end");
    </script>
    <!-- return start 2 5 end 1 3 4 -->
</body>
</html>